home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '90 / MacHack 90 Contest Entries / MIDI DRVR-C.Marshall / About the MIDI Driver
Encoding:
Text File  |  1990-06-14  |  3.6 KB  |  52 lines  |  [TEXT/KAHL]

  1. /************************************************************************************/
  2. /*                                                                                                                */
  3. /* This is a hardware level MIDI interface driver.  It provides direct access to     */
  4. /* the SCC ports when connected to a MIDI interface that provides it's own clock.    */
  5. /* It is an interrupt-driven asynchronous driver that uses two circular buffers to    */
  6. /* queue the data being transferred.  It provides it's own routines to service the    */
  7. /* Level 2 secondary interrupts for the SCC port being used.  The driver MUST    be        */
  8. /* closed properly before it's memory is deallocated, as it replaces the vectors in    */
  9. /* the Lvl2DT table, and these must be replaced with the original ones.                    */
  10. /* This driver doesn't do anything fancy, like time-stamp the MIDI data.  It's        */
  11. /* only reason for being is to get data from the outside world to your computer.        */
  12. /* What you do with it after that is your business.                                            */
  13. /* In order to do this, I have set up two circular buffers that are fed and emptied    */
  14. /* via two assembly language routines that are accessed through usurped LVL2DT        */
  15. /* vectors.  Reads and Writes to the driver interact with these buffers, as opposed    */
  16. /* to direct port access.                                                                                */
  17. /*                                                                                                                */
  18. /* If you really want to find out what's going on here, you should read that nasty    */
  19. /* little rag that Zilog supplies with their Z3580 chip.  It does tell you all that    */
  20. /* you need to know about the SCC, but you may have to read it over several times    */
  21. /* and consult Sister Zapposky's Tarot Emporium to figure it out.                            */
  22. /*                                                                                                                */
  23. /* This project took a lot of blood, sweat and tears, so I am offering it as            */
  24. /* example code, or even as a useable DRVR.  It works beautifully in Pluses, SEs        */
  25. /* and IIs.  I spent many late evenings reading that cheezy Zilog manual, and            */
  26. /* trying to keep from throwing a fit every time my Mac did.  I finally got it        */
  27. /* working, and working well, so enjoy.  If nothing else, it should be a good            */
  28. /* example of a DRVR.                                                                                    */
  29. /*                                                                                                                */
  30. /* A note: This program uses a "hole" in the CODE segment to store a pointer to a    */
  31. /* private globals structure in a similar manner to THINK C's SetUpA4 () routine.    */
  32. /* The MyStash () routine returns this pointer.  I know it's pretty nasty, but it    */
  33. /* works like a charm!  Anyway, I've encapsuled it's access to one routine that can    */
  34. /* easily be modified to accomodate any better methods.                                        */
  35. /*                                                                                                                */
  36. /* I also opted for a very illegal control call to adjust the size of the I/O            */
  37. /* buffers.  This can easily be changed to use the same method that the serial        */
  38. /* driver does.  All you would have to do is replace the buffer pointers with your    */
  39. /* own, and figure a way to properly dispose of the default buffers.  I suggest you    */
  40. /* keep auxilliary pointers to them, and dispose them at the driver's close.            */
  41. /*                                                                                                                */
  42. /* This program is being distributed as a demo only!  If you plan to use it in a        */
  43. /* commercial product, please contact me at: AL:D5070, MARSHALL.CHR,                        */
  44. /*    (301) 990-7773, or (301) 340-4573. - Chris Marshall                                        */
  45. /*                                                                                                                */
  46. /* At the time of this writing, I am working for GE Information Services.                */
  47. /* 401 N. Washington St. M/S: MNC3J, Rockville, MD 20850                                        */
  48. /*                                                                                                                */
  49. /* My home address is: 401 Blue Silk Lane Apt. C, Gaithersburg, Maryland 20879        */
  50. /*                                                                                                                */
  51. /************************************************************************************/
  52.